package at.ltasat.classifier;

public abstract class ClassificationAlgorithm<O, D> {

	private final String name;
	private final ClazzManager<D> classManager;
	private final ObjectFeaturesFactory<O> factory;

	protected ClassificationAlgorithm(String name, ClazzManager<D> classManager, ObjectFeaturesFactory<O> factory) {
		assert classManager != null;
		this.name = name;
		this.classManager = classManager;
		this.factory = factory;
	}

	public String getName() {
		return name;
	}

	public ClazzManager<D> getClazzManager() {
		return classManager;
	}

	public ObjectFeaturesFactory<O> getObjectFeaturesFactory() {
		return factory;
	}

	protected ObjectFeatures getObjectFeatures(O object) {
		ObjectFeatures attributed = factory.create(object);
		assert attributed.getNumberOfFeatures() == factory.getNumberOfFeatures();
		return attributed;
	}

	public int getNumberOfDimensions() {
		return factory.getNumberOfFeatures();
	}
}
